<%@page import="java.math.BigDecimal"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	SettingForm form = (SettingForm)request.getAttribute("command");
	TsUser user = (TsUser)request.getAttribute("user");
	List<BigDecimal> userRoleList = new ArrayList<BigDecimal>();
	if(null!=user){
		if(StringUtils.isNotBlank(user.getRoleIds())){
			String roleArr[] = user.getRoleIds().split(",");
			for(String r:roleArr){
				userRoleList.add(new BigDecimal(r));
			}
		}
	}
	List<TblOaAuthRole> roleList = (List<TblOaAuthRole> )request.getAttribute("roleList");
%>

<div>
	<form id="userAddForm" target="_coreIframe"
		action="<%=request.getContextPath()%>/setting/doEditUser">
		<div class="breadcrumb">
			<div class="bcIcon"></div>
			<ul class="bcNav">
				<li>编辑用户</li>
			</ul>
		</div>
		<input type="hidden" name="userId" value="<%=user.getUserid()%>">
		<table class="formTable">
			<tr>
				<td class="tdTitle">用户ID:</td>
				<td><input class="inputText xs" value="<%=user.getUserid()%>"  disabled="disabled"></td>
			</tr>
			<tr>
				<td class="tdTitle">用户姓名:</td>
				<td><input class="inputText xs" type="text" checkNull="true" name="userName" value="<%=user.getUsername()%>" disabled="disabled"/></td>
			</tr>
			<!-- <tr>
				<td class="tdTitle">可选属性:</td>
				<td>
					<label for="setTop">
						<span style="color: #f89644;">置顶</span>
						<input id="setTop" type="checkbox" name="istop" value="1" />
					</label>
					<label for="setImportant">
						<span style="color: #e1544f;">重要</span>
						<input id="setImportant" type="checkbox" name="isimportant" value="1" />
					</label>
				</td>
			</tr> -->
			<tr>
				<td class="tdTitle">角色：</td>
				<td class="" colspan="2">
					<div style="padding-top:10px;padding-bottom:10px;">
						<div class="checkbox-wrap">
						<%
							if(!CollectionUtils.isEmpty(roleList)){
								for(TblOaAuthRole role:roleList){
									%>
										<label  class="check-label-role" style="display:block; width:20%;">
											<input type="checkbox" 
											data-value="1" 
											value="<%=EncrypTool.encode(role.getRoleId()+"")%>" 
											name="roles" 
											class="checkbox" 
											<%=userRoleList.contains(role.getRoleId())?"checked='checked'":""%>
											 >
											<span><%=role.getRoleDesc() %></span>
										</label>
									<%
								}
							}
						%>
						</div>
					</div>
				</td>
			</tr>
			<tr>
				<td class="tdTitle"></td>
				<td>
					<div>
						<input class="input-btn-microsoft" type="submit" value="提交">
						<a class="a-btn-microsoft" href="javascript:XF.Setting.listUser()">取消</a>
					</div>
				</td>
			</tr>	
		</table>
	</form>
	<iframe id="_coreIframe" name="_coreIframe" style="display: none;"></iframe>
</div>